<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core">

    <body>
    <ui:composition template="/ressources/template/template_public.xhtml">
        
            <ui:param name="page" value="public_cart" />
        
            <ui:define name="body">
            
                <h1>Panier virtuel</h1>
            
                <p>
                    Vous etes sur la page de recapitulatif de votre panier.
                </p>

                <h2>Recapitulatif des financements souhaites :</h2>
                <p>
                    <h:messages style="color: green" layout="table"/>
                    <h:form id="cartForm" >
                        <h:dataTable value="#{currentuser.listCart}" styleClass="dvdtable" var="item" border="0" cellpadding="1" cellspacing="0">
                            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Type"/>
                                </f:facet>
                                <h:outputText value="#{item.type.label}"/>
                            </h:column>

            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Titre"/>
                                </f:facet>
                                <h:outputText value="#{item.title}"/>
                            </h:column>
                            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Details"/>
                                </f:facet>
                                <h:outputText value="#{item.details}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Auteur"/>
                                </f:facet>
                                <h:outputText value="#{item.auteur}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Date"/>
                                </f:facet>
                                <h:outputText value="#{item.datePublication}">
                                     <f:convertDateTime pattern="dd/MM/yyyy"/>
                                </h:outputText>
                            </h:column>

                            
                            <h:column>
                                <h:commandLink action="#{currentuser.removeFromCart}">
                                    <f:param name="id" value="#{item.id}"/>
                                    <h:outputText value="Annuler"/>
                                </h:commandLink>
                            </h:column>
                        </h:dataTable>
                        <br/>
                        <br/>
                        <h:commandLink action="#{currentuser.validCart}">
                            <h:outputText value="Valider la selection"/>
                        </h:commandLink>
                    </h:form> 
                </p>

            </ui:define>
        </ui:composition> 
    </body> 
</html>
